package com.unsins.business.jobcenter;

import org.compass.gps.CompassGps;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.util.Assert;

import java.util.Date;
import java.util.logging.Logger;

/**
 * Created by IntelliJ IDEA.
 * User: odpsoft
 * Date: 2008-11-28
 * Time: 10:39:55
 */
public class CompassIndexJob extends QuartzJobBean implements InitializingBean {
    private CompassGps compassGps;
    private static final Logger logger = Logger.getLogger(CompassIndexJob.class.getName());    

    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("start compass index,start time:"+new Date());
		compassGps.index();
        logger.info("end compass index,end time:"+new Date());
    }

    public void setCompassGps(CompassGps gps) {
        compassGps = gps;
    }

    public void afterPropertiesSet() throws Exception {
        Assert.notNull(compassGps, "compassGps is required!but it is null");
    }
}
